package reflect;

import reflect.annotations.AutoRunClass;
import reflect.annotations.AutoRunMethod;

/**
 * 使用当前类测试反射操作
 */
@AutoRunClass
public class Person {
    private static Person instance = new Person();  //单例模式

    private String name = "张三";
    private int age = 20;

    public Person(){}

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }


    private void he(){
        System.out.println(name+":hehe!");
    }
    @AutoRunMethod(value = 2)
    public void sayHello(){
        System.out.println(name+":hello!");
    }
    @AutoRunMethod(value = 3)
    public void sayHi(){
        System.out.println(name+":hi!");
    }
    public void say(String info){
        System.out.println(name+":"+info);
    }
    public void say(String info,int count){
        for(int i=0;i<count;i++) {
            System.out.println(name + ":" + info);
        }
    }
    public void watchTV(){
        System.out.println(name+"看电视");
    }
    public void playGame(){
        System.out.println(name+"打游戏");
    }
    public void justDoIt(){
        System.out.println(name+"只管干!");
    }
    public void eat(){
        System.out.println(name+"干饭!");
    }
    public void sleep(){
        System.out.println(name+"睡觉!");
    }

}
